Skip to content

Use LangSmith runtime override API instead of monkey-patching aio_to_thread#1477

Draft
xumaple wants to merge 1 commit intomainfrom
maplexu/langsmith-runtime-override
Draft

Use LangSmith runtime override API instead of monkey-patching aio_to_thread#1477
xumaple wants to merge 1 commit intomainfrom
maplexu/langsmith-runtime-override

Conversation

@xumaple
Copy link
Copy Markdown
Contributor

@xumaple xumaple commented Apr 23, 2026

Summary

  • Replace the process-wide monkey-patch of langsmith._internal._aiter.aio_to_thread with LangSmith's official set_runtime_overrides(aio_to_thread=...) API (added in langsmith 0.7.34)
  • Bump langsmith dependency from >=0.7.0 to >=0.7.34

The monkey-patch was fragile against LangSmith internal refactors. The new API is a supported hook for frameworks with non-standard event loops that don't implement run_in_executor.

Test plan

  • All 82 langsmith tests pass (tests/contrib/langsmith/)
  • pyright clean
  • basedpyright clean
  • CI passes

🤖 Generated with Claude Code

…ing aio_to_thread

LangSmith 0.7.34 added `set_runtime_overrides(aio_to_thread=...)` which
provides a supported hook for frameworks with non-standard event loops.
This replaces the process-wide monkey-patch of `langsmith._internal._aiter.aio_to_thread`
with a call to the official API, making the integration less fragile
against LangSmith internal refactors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant